package com.joysuch.wwyt.bp.repository;

import com.joysuch.wwyt.bp.entity.risk.BpJudgeDepart;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.time.LocalDate;
import java.util.List;

/**
 * @Author ZhangDong
 * @Date 2020/3/6 10:41
 */
public interface BpDepartRepository extends JpaRepository<BpJudgeDepart, Long>, JpaSpecificationExecutor<BpJudgeDepart> {


    @Query("select bd from BpJudgeDepart bd where bd.reportDate=:reportDate and bd.releaseStatus=:releaseStatus")
    List<BpJudgeDepart> findByReportDateAndReleaseStatus(@Param("reportDate") LocalDate reportDate,
                                                         @Param("releaseStatus") String releaseStatus);

    List<BpJudgeDepart> findByReportDateAndHigherDepartId(@Param("reportDate") LocalDate reportDate,
                                                          @Param("higherDepartId") Long higherDepartId);
}
